﻿/**
 * ...
 * @author George Mavchun
 */

package gui.hug.priv;

import flash.display.Shape;
import flash.display.Sprite;
import flash.text.TextFormat;
import gui.hug.HUGLabel;

class HUGButtonDisplayState extends Sprite
{
	private var labelIndent : Int;

	public function new(text : String, textFormat : TextFormat, bgColor : Int, ?labelIndent : Int) 
	{
		super();
		this.labelIndent = labelIndent == null ? 12 : labelIndent;
		addImage(text, textFormat, bgColor);
	}

	private function addImage(text : String, textFormat : TextFormat, bgColor : Int) {
		var label : HUGLabel = new HUGLabel();
		label.setLocation(labelIndent, 0);
		label.text = text;
		label.setTextFormat(textFormat);
		
		var shape = new Shape();
		shape.graphics.beginFill(bgColor);
		shape.graphics.drawRoundRectComplex(0, 0, labelIndent + label.width + labelIndent, 20, 3, 3, 3, 3);
		shape.graphics.endFill();
		
		addChild(shape);
		addChild(label);
	}
}